/*

Sinisa Miric and Anna O. Pechenkina

``Elite selection in single-party autocracies: Minimizing protests and 
counterproductive state violence to maintain social stability''

Political Research Quarterly

Replication materials

*/

cd "/Users/.../MiricPechenkina2022_replication/"

use "MiricPechenkina_sc_data_replication.dta", replace


/* 
Table 1: Career outcomes 
*/

tab dv_ordinal
tab dv_ordinal_str1last /*note that "-2" in string is displayed after "-1"*/

/** 
Table 2: Effects of increase in the frequency of strikes and of 
violent state response on career outcomes of party secretaries
**/


imb  gdpgrowthrate_ord  princeling mishu  age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces , treatment(diffstrikespc_adj_bin75)
cem  gdpgrowthrate_ord  princeling mishu  age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces , treatment(diffstrikespc_adj_bin75)
imb  gdpgrowthrate_ord  princeling mishu  age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces , treatment(diffstrikespc_adj_bin75) useweights


reg dv_ord_3cat diffstrikespc_adj_bin75  gdpgrowthrate_ord  princeling mishu  age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc
eststo model1
reg dv_ord_3cat diffstrikespc_adj_bin75  gdpgrowthrate_ord  princeling mishu  age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc [iweight = cem_weights]
eststo model2


use "MiricPechenkina_sc_data_replication_nomissing.dta", replace
/** NOTE: the imb algorith cannot handle missing values in the treatment or if statements, 
so use the dataset without 3 missing values in the diff_strikes_viol_bin75 variable*/

imb  meanstrikes_bin50 gdpgrowthrate_ord  princeling mishu  age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces , treatment(diff_strikes_viol_bin75)
cem  meanstrikes_bin50 gdpgrowthrate_ord  princeling mishu  age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces , treatment(diff_strikes_viol_bin75)
imb  meanstrikes_bin50 gdpgrowthrate_ord  princeling mishu  age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces , treatment(diff_strikes_viol_bin75) useweights



reg dv_ord_3cat diff_strikes_viol_bin75 meanstrikes_bin50 gdpgrowthrate_ord  princeling mishu  age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc
eststo model3
reg dv_ord_3cat diff_strikes_viol_bin75 meanstrikes_bin50 gdpgrowthrate_ord  princeling mishu  age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc [iweight = cem_weights]
eststo model4


esttab model1  model2 model3 model4 using table2_paper.tex, replace f ///
 	label booktabs margin se(3) eqlabels(none) alignment(S S) collabels("\multicolumn{1}{c}{$\beta$ / SE}") ///
	star(* 0.1 ** 0.05 *** 0.01 ) r2 aic bic	

	
/** 
Table 3: The impact of political performance, economic performance, and 
patronage networks on party secretaries’ career outcomes
**/
use "MiricPechenkina_sc_data_replication.dta", replace


eststo model5: ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 

eststo model6: ologit dv_ord_3cat strikes_pc_mean econgrowth_mean  princeling mishu  age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 


eststo model7: ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  xi_job_years zhu_job_years wen_job_years likeqiang_job_years jiang_job_years zhou_job_years age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 

eststo model8: ologit dv_ord_3cat strikes_pc_mean econgrowth_mean  xi_job_years zhu_job_years wen_job_years likeqiang_job_years jiang_job_years zhou_job_years  age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 


esttab model5 model6 model7 model8   using table3_paper.tex, replace f ///
 	label booktabs margin se(3) eqlabels(none) alignment(S S) collabels("\multicolumn{1}{c}{$\beta$ / SE}") ///
	star(* 0.1 ** 0.05 *** 0.01 ) pr2 aic bic 
	
	
/**
Generating predicted probabilities for Figure 1: Predicted probabilities of career outcomes by political performance -- based on model 5
**/	
su diffstrikespc_adj, detail

**Great performance: 2SD decrease in strikes over tenure: demotion, no change, promotion

quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(-1))  at(diffstrikespc_adj== -.0005839 ) atmeans post

quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(0))  at(diffstrikespc_adj== -.0005839 ) atmeans post

quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(1))  at(diffstrikespc_adj== -.0005839 ) atmeans post

/*
career_str	strikes_str		mean		se			z		p		lower		upper		
demotion	decline_2SD		.0133898   .0074874     1.79   0.074    -.0012851    .0280648	
no change	decline_2SD		.3959255   .0903428     4.38   0.000     .2188567    .5729942
promotion	decline_2SD		.5906847   .0952597     6.20   0.000     .4039792    .7773902
*/

**Good performance: 1SD decrease in strikes over tenure: demotion, no change, promotion

quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(-1))  at(diffstrikespc_adj== -.0003045 ) atmeans post
	 
quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(0))  at(diffstrikespc_adj== -.0003045 ) atmeans post
	 
quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(1))  at(diffstrikespc_adj== -.0003045 ) atmeans post

/*
career_str	strikes_str		mean		se			z		p		lower		upper		
demotion 	decline_1SD 	.0204693   .0090636     2.26   0.024     .0027049    .0382337
no change 	decline_1SD		.4957335   .0623364     7.95   0.000     .3735565    .6179106
promotion 	decline_1SD		.4837972   .0656147     7.37   0.000     .3551948    .6123995
*/	 
	 
**Average performance: no change in strikes over tenure: demotion, no change, promotion

quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(-1))  at(diffstrikespc_adj== 0 ) atmeans post
	 
quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(0))  at(diffstrikespc_adj== 0 ) atmeans post
	 
quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(1))  at(diffstrikespc_adj== 0 ) atmeans post
	 
	 
/*
career_str	strikes_str		mean		se			z		p		lower		upper		
demotion 	no change		.0323661   .0117411     2.76   0.006     .0093541    .0553782
no change	no change		.5983384   .0468144    12.78   0.000     .5065839    .6900928
promotion	no change	 	.3692955   .0457993     8.06   0.000     .2795305    .4590605
*/

**Bad performance: 1SD increase in strikes over tenure: demotion, no change, promotion

quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(-1))  at(diffstrikespc_adj== .0003045 ) atmeans post
	 
quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(0))  at(diffstrikespc_adj== .0003045 ) atmeans post
	 
quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(1))  at(diffstrikespc_adj== .0003045 ) atmeans post
	
/*
career_str	strikes_str		mean		se			z		p		lower		upper		
demotion 	no change		.0508187   .0182447     2.79   0.005     .0150598    .0865776
no change	no change		.6813486   .0527405    12.92   0.000     .5779792     .784718
promotion	no change	 	.2678327   .0535674     5.00   0.000     .1628425    .3728229
*/	

**Abysmal performance: 2SD increase in strikes over tenure: demotion, no change, promotion

quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(-1))  at(diffstrikespc_adj== .0004801  ) atmeans post
	 
quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(0))  at(diffstrikespc_adj== .0004801 ) atmeans post
	 
quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(1))  at(diffstrikespc_adj== .0004801 ) atmeans post
	
/*
career_str	strikes_str		mean		se			z		p		lower		upper		
demotion 	no change	 	.0656165   .0256237     2.56   0.010      .015395     .115838
no change	no change		.7163088   .0545742    13.13   0.000     .6093453    .8232724
promotion	no change	 	.2180747   .0604088     3.61   0.000     .0996757    .3364737
*/	

/** 
How much does one’s political performance matter in relation to his/her privileged status as a princeling? 
If we compare two hypothetical provincial secretaries, both of whom reduced strikes per capita during their 
tenure by 1 standard deviation below average, the non-princeling official in the pair will have a 44% chance 
at promotion, while the princeling official’s probability of promotion is double that at 90%. Furthermore, 
bad political performance hurts non-princelings more than it does princelings. Comparing two hypothetical 
officials during whose tenure strikes grew 1 standard deviation above average, the non-princeling is predicted 
to receive a promotion at 24% (a 20-percentage point decline relative to an identical party secretary with 
excellent political performance), while a princeling’s probability of promotion declines to a 78% chance 
(only an 12-percentage point drop). Similarly, the harmful impact of state violent response to strikes also 
matters more for non-Mishu and non-princeling secretaries.
**/

**Good performance for princeling vs. non-princeling: 1SD decrease in strikes over tenure: demotion, no change, promotion

quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(-1))  at(diffstrikespc_adj== -.0003045 princeling = (0 1)) atmeans post
	 
quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(0))  at(diffstrikespc_adj== -.0003045 princeling = (0 1)) atmeans post
	 
quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(1))  at(diffstrikespc_adj== -.0003045 princeling = (0 1)) atmeans post
/*
career_str	status		strikes_str		mean		se			z		p		lower		upper		
demotion 	non-prince	decline_1SD		.0239781   .0103513     2.32   0.021     .0036899    .0442664
demotion 	prince		decline_1SD 	.0021018   .0023034     0.91   0.362    -.0024128    .0066165
no change 	non-prince	decline_1SD		.5324403   .0623789     8.54   0.000     .4101799    .6547008
no change 	prince		decline_1SD		.0949996   .0819478     1.16   0.246    -.0656151    .2556143
promotion 	non-prince	decline_1SD		.4435816   .0657536     6.75   0.000     .3147069    .5724562
promotion 	prince		decline_1SD		.9028985   .0840785    10.74   0.000     .7381078    1.067689
*/	 
         

**Average performance for princeling vs. non-princeling: 1SD decrease in strikes over tenure: demotion, no change, promotion

quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(-1))  at(diffstrikespc_adj== 0 princeling = (0 1)) atmeans post
	 
quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(0))  at(diffstrikespc_adj== 0 princeling = (0 1)) atmeans post
	 
quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(1))  at(diffstrikespc_adj== 0 princeling = (0 1)) atmeans post
/*
career_str	status		strikes_str		mean		se			z		p		lower		upper		
demotion 	non-prince	no change		.0378355   .0133404     2.84   0.005     .0116888    .0639823
demotion 	prince		no change 		.0033601   .0035241     0.95   0.340    -.0035471    .0102672
no change 	non-prince	no change		.6296968   .0475967    13.23   0.000     .5364089    .7229846
no change 	prince		no change		.1434995   .1125873     1.27   0.202    -.0771676    .3641665
promotion 	non-prince	no change		.3324677   .0460548     7.22   0.000      .242202    .4227334
promotion 	prince		no change		.8531405   .1158188     7.37   0.000     .6261397    1.080141
*/
         

**Poor performance for princeling vs. non-princeling: 1SD decrease in strikes over tenure: demotion, no change, promotion

quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(-1))  at(diffstrikespc_adj== .0003045 princeling = (0 1)) atmeans post
	 
quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(0))  at(diffstrikespc_adj== .0003045 princeling = (0 1)) atmeans post
	 
quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(1))  at(diffstrikespc_adj== .0003045 princeling = (0 1)) atmeans post
/*
career_str	status		strikes_str		mean		se			z		p		lower		upper		
demotion 	non-prince	increase_1SD	.0592155   .0207895     2.85   0.004     .0184689    .0999622	
demotion 	prince		increase_1SD 	.0053674   .0055356     0.97   0.332    -.0054822     .016217
no change 	non-prince	increase_1SD	.7034685   .0512047    13.74   0.000     .6031091    .8038279	
no change 	prince		increase_1SD	.2106477   .1515964     1.39   0.165    -.0864757    .5077711	
promotion 	non-prince	increase_1SD	.237316    .0516629     4.59   0.000     .1360585    .3385734	
promotion 	prince		increase_1SD	.7839849   .1566521     5.00   0.000     .4769525    1.091017	
*/


**Good performance for Mishu vs. non-Mishu: 1SD decrease in strikes over tenure: demotion, no change, promotion

quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(-1))  at(diffstrikespc_adj== -.0003045 mishu = (0 1)) atmeans post
	 
quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(0))  at(diffstrikespc_adj== -.0003045 mishu = (0 1)) atmeans post
	 
quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(1))  at(diffstrikespc_adj== -.0003045 mishu = (0 1)) atmeans post

/*
career_str	status		strikes_str		mean		se			z		p		lower		upper		
demotion 	non-MISHU	decline_1SD		.0238602   .0104085     2.29   0.022     .0034599    .0442604
demotion 	MISHU		decline_1SD 	.0047375   .0041896     1.13   0.258     -.003474     .012949
no change 	non-MISHU	decline_1SD		.5313107   .0617278     8.61   0.000     .4103264     .652295
no change 	MISHU		decline_1SD		.190786   	.1184982    1.61   0.107    -.0414661    .4230382
promotion 	non-MISHU	decline_1SD		.4448291    .065237     6.82   0.000     .3169669    .5726913
promotion 	MISHU		decline_1SD		.8044764   .1221838     6.58   0.000     .5650006    1.043952
*/	 
       
**Average performance for Mishu vs. non-Mishu: no change in strikes over tenure: demotion, no change, promotion

quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(-1))  at(diffstrikespc_adj== 0 mishu = (0 1)) atmeans post
	 
quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(0))  at(diffstrikespc_adj== 0 mishu = (0 1)) atmeans post
	 
quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(1))  at(diffstrikespc_adj== 0 mishu = (0 1)) atmeans post
	       

/*
career_str	status		strikes_str		mean		se			z		p		lower		upper		
demotion 	non-MISHU	no change		.037652   .0134971     2.79   0.005     .0111983    .0641058
demotion 	MISHU		no change 		.0075616   .0062738     1.21   0.228    -.0047349    .0198581
no change 	non-MISHU	no change		.6287579   .0469857    13.38   0.000     .5366675    .7208483
no change 	MISHU		no change		.2725104    .143613     1.90   0.058    -.0089658    .5539866
promotion 	non-MISHU	no change		.3335901   .0456991     7.30   0.000     .2440214    .4231587
promotion 	MISHU		no change		.719928   .1490213     4.83   0.000     .4278517    1.012004
*/	 
      
         
**Bad performance for Mishu vs. non-Mishu: 1SD increase in strikes over tenure: demotion, no change, promotion

quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(-1))  at(diffstrikespc_adj== .0003045 mishu = (0 1)) atmeans post
	 
quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(0))  at(diffstrikespc_adj== .0003045 mishu = (0 1)) atmeans post
	 
quietly ologit dv_ord_3cat diffstrikespc_adj   diffecongrowth  princeling mishu age_3cat militarybackground tenure_dur MinorityRegion Top11Provinces i.province_enc 
margins, predict(outcome(1))  at(diffstrikespc_adj== .0003045 mishu = (0 1)) atmeans post
	

/*
career_str	status		strikes_str			mean		se			z		p		lower		upper		
demotion 	non-MISHU	increase_1SD		.0589346   .0210541     2.80   0.005     .0176693       .1002
demotion 	MISHU		increase_1SD 		.0120487   .0097772     1.23   0.218    -.0071143    .0312116
no change 	non-MISHU	increase_1SD		.7028336   .0508884    13.81   0.000     .6030942     .802573
no change 	MISHU		increase_1SD		.3716926   .1678711     2.21   0.027     .0426713    .7007138
promotion 	non-MISHU	increase_1SD		.2382318   .0516659     4.61   0.000     .1369685    .3394951
promotion 	MISHU		increase_1SD		.6162587   .1762388     3.50   0.000      .270837    .9616804
*/	         
             
